<?php

if(!$GLOBALS['USER']->isLogin()){
	
	$TPL_PATH = dirname(__FILE__) . "/tpl/";
	$PHP_PATH = dirname(__FILE__) . "/php/";
	
	$content = file_get_contents($TPL_PATH . 'main.tpl');
	
	$out = strtr(file_get_contents("template/main.tpl"),
	array(
	'{CONTENT}' => $content,
		)
	);
}
else {
	
	if($URLC->getHtmlPage() == 'exit'){
		$userLogin->logout(true);
	}
	if($userLogin->getData()->rights == 1){
		header("Location:/backend/gallery.html");
	}
	else{
		header("Location:/login/");
	}
	
	exit();
}